{% extends "base.html" %}

{% block title %}
    List User
{% endblock %}

{% block content %}
    <div class="btn-toolbar">
        <div class="btn-group">
            <a class="btn btn-default {%if request.path = '/accounts/user/add/'%} active {%endif%}" href="/accounts/user/add"><span class="glyphicon glyphicon-edit"></span>新建用户</a>
            <a class="btn btn-default {%if request.path = '/accounts/user/list/'%} active {%endif%}" href="/accounts/user/list"><span class="glyphicon glyphicon-list"></span>用户列表</a>
        </div>
    </div>

    <hr/>

    <table class="table table-hover table-striped  table-bordered table-condensed">
        <tr>
            <th>账号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>Email</th>
            <th>状态</th>
            <th>角色</th>
            <th>最后登录时间</th>
            <th>操作</th>
        </tr>

            {% for i in lPage %}
                <tr style="font-size: 13px;">
                    <td>{{ i.username }}</td>
                    <td>{{ i.nickname|default:"----" }}</td>
                    <td>{{ i.sex|default:"----" }}</td>
                    <td>{{ i.email }}</td>
                    <td>
                        {% if i.is_active %}
                            <span class="label label-success">启用</span>
                        {% else %}
                            <span class="label label-default">禁用</span>
                        {% endif %}
                    </td>
                    <td>{{ i.role|default:"----" }}</td>
                    <td>{{ i.last_login|date:"Y-m-d H:i:s" }}</td>
                    <td class="host_buttom">
                        <a class="btn btn-warning btn-xs"  href="/accounts/user/edit/{{ i.id }}">编辑</a>
                        <a class="btn btn-danger btn-xs" href="/accounts/user/delete/{{ i.id }}" onclick="return confirm('是否确认删除？')">删除</a>
                    </td>
                </tr>
            {% endfor %}

        </table>

    {% include "common/paginator.html" %}
{% endblock %}
